﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace GLinq
{
    class GLinqExpression
    {
        protected GLinqExpression BaseExpression;
        internal Type Type;

        internal GLinqExpression(GLinqExpression baseExpr)
        {
            this.BaseExpression = baseExpr;
        }
    }

    class InputGridExpression : GLinqExpression
    {
        internal string DataSource { get; set; }
        internal GridSize Size { get; set; }

        internal InputGridExpression(GridSize size, Type t, string dataSrc)
            : base(null)
        {
            this.DataSource = dataSrc;
            this.Size = size;
            this.Type = t;
        }
    }

    class InputBufferExpression : GLinqExpression
    {
        internal string DataSource { get; set; }
        internal int Size { get; set; }

        internal InputBufferExpression(int size, Type t, string dataSrc)
            : base(null)
        {
            this.DataSource = dataSrc;
            this.Size = size;
            this.Type = t;
        }
    }

    class StreamOutExpression : GLinqExpression
    {
        internal StreamOutExpression(GLinqExpression baseExpr)
            : base(baseExpr)
        {
        }
    }


    class SelectExpression : GLinqExpression
    {
        internal LambdaExpression Selector;

        internal SelectExpression(GLinqExpression baseExpr, LambdaExpression selector)
            : base(baseExpr)
        {
            this.Selector = selector;
        }
    }

    class UnionExpression : GLinqExpression
    {
        internal UnionExpression(GLinqExpression baseExpr)
            : base(baseExpr)
        {
        }
    }

    class SelectParallelExpression : GLinqExpression
    {
        internal LambdaExpression Selector;

        internal SelectParallelExpression(GLinqExpression baseExpr, LambdaExpression selector)
            : base(baseExpr)
        {
            this.Selector = selector;
        }
    }

    class ScatterExpression : GLinqExpression
    {
        internal LambdaExpression DestinationSelector;

        internal ScatterExpression(GLinqExpression baseExpr, LambdaExpression destSelector)
            : base(baseExpr)
        {
            DestinationSelector = destSelector;
        }
    }

    class ScatterManyExpression : GLinqExpression
    {
        internal LambdaExpression DestinationSelector;

        internal ScatterManyExpression(GLinqExpression baseExpr, LambdaExpression destSelector)
            : base(baseExpr)
        {
            DestinationSelector = destSelector;
        }
    }

    class WhereExpression : GLinqExpression
    {
        internal LambdaExpression Filter;

        internal WhereExpression(GLinqExpression baseExpr, LambdaExpression filter)
            : base(baseExpr)
        {
            this.Filter = filter;
        }
    }

    class ConsumeExpression : GLinqExpression
    {
        internal int MaxLength;

        internal ConsumeExpression(GLinqExpression baseExpr, int maxLen)
            : base(baseExpr)
        {
            this.MaxLength = maxLen;
        }
    }
}
